// store/modules/power.js
export default {
  namespaced: true,
  state: {
    lBusTie: true,
    rBusTie: true,
    utilBus: true,
    lGenCtrl: true,
    rGenCtrl: true,
    ApuGen: true,
    lBackupGen: true,
    rBackupGen: true,
    secExtPwr: false,
    prtExtPwr: false
  },
  mutations: {
    toggleLBusTie(state) {
      state.lBusTie = !state.lBusTie
    },
    toggleRBusTie(state) {
      state.rBusTie = !state.rBusTie
    },
    toggleUtilBus(state) {
      state.utilBus = !state.utilBus
    },
    toggleLGenCtrl(state) {
      state.lGenCtrl = !state.lGenCtrl
    },
    toggleRGenCtrl(state) {
      state.rGenCtrl = !state.rGenCtrl
    },
    toggleApuGen(state) {
      state.ApuGen = !state.ApuGen
    },
    toggleLBackupGen(state) {
      state.lBackupGen = !state.lBackupGen
    },
    toggleRBackupGen(state) {
      state.rBackupGen = !state.rBackupGen
    },
    toggleSecExtPwr(state) {
      state.secExtPwr = !state.secExtPwr
    },
    togglePrtExtPwr(state) {
      state.prtExtPwr = !state.prtExtPwr
    }
  },
  actions: {
    toggleLBusTie({ commit }) {
      commit('toggleLBusTie')
    },
    toggleRBusTie({ commit }) {
      commit('toggleRBusTie')
    },
    toggleUtilBus({ commit }) {
      commit('toggleUtilBus')
    },
    toggleLGenCtrl({ commit }) {
      commit('toggleLGenCtrl')
    },
    toggleRGenCtrl({ commit }) {
      commit('toggleRGenCtrl')
    },
    toggleApuGen({ commit }) {
      commit('toggleApuGen')
    },
    toggleLBackupGen({ commit }) {
      commit('toggleLBackupGen')
    },
    toggleRBackupGen({ commit }) {
      commit('toggleRBackupGen')
    },
    toggleSecExtPwr({ commit }) {
      commit('toggleSecExtPwr')
    },
    togglePrtExtPwr({ commit }) {
      commit('togglePrtExtPwr')
    }
  },
  getters: {
    // Getter方法：返回每个状态的值
    lBusTie: (state) => state.lBusTie,
    rBusTie: (state) => state.rBusTie,
    utilBus: (state) => state.utilBus,
    lGenCtrl: (state) => state.lGenCtrl,
    rGenCtrl: (state) => state.rGenCtrl,
    ApuGen: (state) => state.ApuGen,
    lBackupGen: (state) => state.lBackupGen,
    rBackupGen: (state) => state.rBackupGen,
    secExtPwr: (state) => state.secExtPwr,
    prtExtPwr: (state) => state.prtExtPwr
  }
}
